package com.intellagric.controller.module.ift_data_record;

import com.intellagric.common.pojo.LayuiDataGridResult;
import com.intellagric.common.pojo.ResponseMessage;
import com.intellagric.service.search.pojo.DataRecordVo;
import com.intellagric.pojo.IftDataRecord;
import com.intellagric.service.iftmonitor.ift_data_record.DataRecordService;
import com.intellagric.service.search.IftDataRecordSearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.xml.crypto.Data;
import java.util.UUID;

/**
 * @Author: zhy
 * @email: 1269679946@qq.com
 * @Date: 2018/10/21
 * @DESC： 数据记录查询
 */
@Controller
public class SearchDataRecordController {

    @Autowired
    private DataRecordService dataRecordService;

    @Autowired
    private IftDataRecordSearchService dataRecordSearchService;

    /**
     * 查询数据记录信息列表，导入索引库
     * @return ResponseMessage
     */
    @RequestMapping("/search/datarecord/import")
    @ResponseBody
    public ResponseMessage importIndex() {
        return dataRecordSearchService.importDataRecord();
    }

    /**
     * 分页查询数据记录信息列表
     * @return LayuiDataGridResult
     */
    @RequestMapping("/search/datarecord/page")
    @ResponseBody
    public LayuiDataGridResult getPage(int page,int limit) {
        return dataRecordSearchService.searchDatarecordPage(page,limit);
    }

    /**
     * 多条件分页查询数据记录信息列表
     * @return LayuiDataGridResult
     */
    @RequestMapping("/search/datarecord/query")
    @ResponseBody
    public LayuiDataGridResult getWithRelationByVo(DataRecordVo dataRecordVo) {
        return dataRecordSearchService.searchDatarecordByVo(dataRecordVo);
    }

    /**
     * 多条件分页查询数据记录信息列表
     * @return LayuiDataGridResult
     */
    @RequestMapping("/search/datarecord/page/query")
    @ResponseBody
    public LayuiDataGridResult getPageWithRelationByVo(int page, int limit, DataRecordVo dataRecordVo) {
        return dataRecordSearchService.searchDatarecordPageByVo(dataRecordVo,page,limit);
    }
}
